package ThreadPool;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author wang'ji'cheng
 * @date 2025/7/16
 */
public class ThreadPoolDemo2 {
    public static void main(String[] args) {
        //核心线程数
        // 最大线程数量
        //临时线程最大存活时间
        //时间单位
        //阻塞队列
        //创建线程工厂
        //任务拒绝策略
        ThreadPoolExecutor pool = new ThreadPoolExecutor(
                3,
                6 ,
                60 ,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(3),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy()
                );
        pool.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName()+"执行了");
            }
        });
    }
}
